package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.constant.OrderConstant;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/25 8:46 周五
 * @description :
 */
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("/consumer")
public class OrderController {

    private final RestTemplate restTemplate;

    @GetMapping("/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Integer id) {
        return restTemplate.getForObject(OrderConstant.SERVER_URL + "/payment/nacos/" + id, String.class);
    }

}
